package jcer.core;

import java.nio.channels.SelectionKey;

public class ConnectionOpenHandler extends BaseEventHandler {
	 

	ConnectionOpenHandler(EventDriver driver) {
		super(driver);
	}

	@Override
	public void execute(Event event) throws Exception {
		Connection conn = event.conn;

		conn.socket.configureBlocking(false);
		conn.socket.register(conn.selector, SelectionKey.OP_READ, conn);
		conn.state = Connection.State.READ_HEADER;
		conn.readBuf.position(0);
		conn.readBuf.limit(Packet.getHeaderLen());
	}

	@Override
	public void init() {
	}

}
